import styles from './index.less'
import { ReactComponent as Logout } from '../../assets/logout.svg'
import { ReactComponent as OpenLink } from '../../assets/open_link.svg'
import { history,Link } from 'umi'

const Dropdown = ({ setDropdownVisible, setPopupVisible }: any) => {

	const logout = () => {
		setPopupVisible(false)
		localStorage.removeItem('token')
		history.push('/login')
	}

	return (
		<div className={styles.box_view}>
			<div className={styles.mask} onClick={() => setDropdownVisible(false)}></div>
			<div className={styles.dropdown_list}>
				<button className={styles.item} onClick={() => window.open('https://help.openai.com/en/collections/3742473-chatgpt', '_blank')}>
					<OpenLink />
					<p>Help & FAQ</p>
				</button>
				<div className={styles.item} onClick={logout} style={{borderTop: '#343541 1px solid'}}>
					<Logout/>
					<p>Log out</p>
				</div>
			</div>
		</div>

	)
}

export default Dropdown
